package com.dong.ioc.javabased.condition;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Profile;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.MultiValueMap;

import java.util.List;

/**
 * description
 *
 * @author Administrator 2021/09/06 14:29
 */
public class MyCondition implements Condition {

    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
        MultiValueMap<String,Object> map= annotatedTypeMetadata.getAllAnnotationAttributes(HelloCondition.class.getName());
        List<Object> list = map.get("value");
        StringBuilder sb = new StringBuilder();
        for (Object o: list){
            sb.append(o);
        }
        System.out.println(sb.toString());
        return true;
    }
}
